#!/usr/bin/env bash
# Copyright (c) 2020 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(tilem)
pkgdesc="TI-84+ calculator emulator"
url=https://github.com/timower/rM2-stuff/tree/master/apps/tilem
_tag=0.1.2
pkgver=${_tag}-1
timestamp=2024-05-29T17:05:56Z
maintainer="Mattéo Delabre <spam@delab.re>"
license=GPL-3.0
section="utils"
image=base:v3.1
installdepends=(display)
flags=(nostrip)

source=()
sha256sums=()

prepare() {
    cd "$srcdir"
    mkdir -p tilem
    cd tilem
    git init
    git lfs install
    git remote add origin https://github.com/timower/rM2-stuff.git
    git fetch --depth 1 origin tag v${_tag} --no-tags
    git checkout v${_tag}
    git lfs fetch
    git lfs checkout
}

build() {
    cd "$srcdir"
    mkdir install
    cd tilem
    cmake --preset release-toltec
    cmake \
        --build build/release-toltec \
        --target tilem
    cmake \
        --install build/release-toltec \
        --prefix ../install \
        --component tilem \
        --strip
}

package() {
    cp -r "$srcdir/install/." "$pkgdir"
}
